<?php
	require_once("oh.framework/oh.framework.php");

	oh("page")
		->header_title("oh.framework - developer dashboard")
		->menu(array(
			"Status"	=> "?page=home",
			"Apps" 		=> "?page=apps",
			"Testing"	=> "?page=testing",
			"Snippets"	=> "?page=snippets",
			"Database"	=> "?page=database",
			"Php"		=> "?page=php"
		))
		->set("header.right",'<a href="docs/">documentation</a>')
		->open("content.body")
	;
	
	function listo($title,$folder) {
		oh("page")->set("content.title",$title);
		$d = scandir("demo/$folder");
		foreach($d as $i) {
			if ($i{0}!=".") {
				if (file_exists("demo/$folder/$i/index.php")) {
					#echo '<a target="_blank" href="demo/'.$folder.'/'.$i.'/">'.$i.'</a> ';
					echo '<a target="_blank" href="editor.php?open=demo/'.$folder.'/'.$i.'/index.php">'.$i.'</a> ';
					#echo '[<a target="_blank" href="editor.php?open=demo/'.$folder.'/'.$i.'/index.php">edit</a>]';
					echo '<br/>';
				}
			}
		}
	}
	
	if (oh("page.is.home")) {
		oh("page")->set("content.title","Status");
		oh("page")->set("history","Status");
		oh("kernel")->info();
	}
	
	if (oh("page.is.apps")) {
		listo("Applications","apps");
	}

	if (oh("page.is.testing")) {
		listo("Testing","testing");
	}

	if (oh("page.is.snippets")) {
		listo("Snippets","snippets");
	}

	if (oh("page.is.database")) {
		oh("page")->set("content.title","Database");
		oh("adminer");
	}

	if (oh("page.is.php")) {
		echo 'Current PHP version: ' . phpversion();
	}
		
	oh("page")
	->stop("content.body")
	->show();
?>
